<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <script>
    // 04 原型链创建对象  创建一个类似的对象  
    //将对象内部的属性 赋值给另一个对象的原型链__proto__
    var car = {
      name: "布加迪威航",
      color: "蓝色",
      run: function () {
        alert("贵")
      }
    }
    //每个对象都有原型链
    var weihang = {}
    console.log(weihang)
    weihang.__proto__ = car;
    weihang.run()
    // 原型方法封装
    var car1 = {
      name: "科尼塞克",
      color: "黑色",
      run: function () { }
    }
    function makeCar(obj) {
      var car = {}
      car.__proto__ = obj;
      return car
    }
    makeCar(car)
    makeCar(car1)
  </script>
</body>

</html>